package com.prs.crm.domain.flow;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;
@Entity
@Table(name="flow_node")
public class WorkFlowNode extends BaseEntity{

	private static final long serialVersionUID = -4048385976632605302L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String name;
	@ManyToOne
	private WorkFlow flow;
	
	@OneToOne(mappedBy="node")
	@Cascade({org.hibernate.annotations.CascadeType.DELETE,org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
    private WorkFlowExtra extra;
	
	private Integer type;
	
	private Integer sequence;
	
	
	private String remark;
	
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setFlow(WorkFlow flow) {
		this.flow = flow;
	}
	public WorkFlow getFlow() {
		return flow;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public Integer getType() {
		return type;
	}
	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}
	public Integer getSequence() {
		return sequence;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getRemark() {
		return remark;
	}
	public void setExtra(WorkFlowExtra extra) {
		this.extra = extra;
	}
	public WorkFlowExtra getExtra() {
		return extra;
	}
	
	@Override
	public boolean equals(Object o)
	{
		if (o instanceof WorkFlowNode)
		{
			if (this.getId()==null)
				return false;
			if (this.getId().equals(((WorkFlowNode)o).getId()))
				return true;
			else
				return false;
		}
		else
		{
			return false;
		}
	}
	
	
}
